home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 23 / Amiga Format AFCD23 (Feb 1998, Issue 107).iso / -in_the_mag- / emulation / consoles / vision-8 / sources / hitech.c < prev    next >
C/C++ Source or Header  |  1997-12-12  |  2KB  |  95 lines

  1. /****************************************************************************/
  2. /**                                                                        **/
  3. /**                                HiTech.c                                **/
  4. /**                                                                        **/
  5. /** Bug fixes and speed-ups for Hi-Tech C CP/M-80 3.09                     **/
  6. /**                                                                        **/
  7. /** Copyright (C) Marcel de Kogel 1997                                     **/
  8. /**     You are not allowed to distribute this software commercially       **/
  9. /**     Please, notify me, if you make any changes to this file            **/
  10. /****************************************************************************/
  11.  
  12. #ifdef HI_TECH_C
  13. #ifdef z80
  14.  
  15. #include <stdlib.h>
  16.  
  17. /* In the library version, c and n and reversed */
  18. void *memset (void *p,int c,size_t n)
  19. {
  20.  register char *_p=(char*)p;
  21.  while (n--) *_p++=c;
  22.  return p;
  23. }
  24.  
  25. #asm
  26.         ; Sped up shift logical right routine
  27.         ; HL=HL>>B
  28.         global  shlr
  29. shlr:   ld      a,b
  30.         or      a               ; Check for zero shift
  31.         ret     z
  32.         sub     8               ; Is the shift >8 ?
  33.         jp      nc,1f           ; yup
  34.         srl     h               ; Shift is <8, do it the hard way
  35.         rr      l
  36.         dec     b
  37.         ret     z
  38.         srl     h
  39.         rr      l
  40.         dec     b
  41.         ret     z
  42.         srl     h
  43.         rr      l
  44.         dec     b
  45.         ret     z
  46.         srl     h
  47.         rr      l
  48.         dec     b
  49.         ret     z
  50.         srl     h
  51.         rr      l
  52.         dec     b
  53.         ret     z
  54.         srl     h
  55.         rr      l
  56.         dec     b
  57.         ret     z
  58.         srl     h
  59.         rr      l
  60.         dec     b
  61.         ret     z
  62.         srl     h
  63.         rr      l
  64.         ret
  65. 1:      ld      l,h             ; Shift 8 bits
  66.         ld      h,0
  67.         ret     z               ; Return if shift==8
  68.         srl     l               ; If not, shift some more
  69.         dec     a
  70.         ret     z
  71.         srl     l
  72.         dec     a
  73.         ret     z
  74.         srl     l
  75.         dec     a
  76.         ret     z
  77.         srl     l
  78.         dec     a
  79.         ret     z
  80.         srl     l
  81.         dec     a
  82.         ret     z
  83.         srl     l
  84.         dec     a
  85.         ret     z
  86.         srl     l
  87.         dec     a
  88.         ret     z
  89.         srl     l
  90.         ret
  91. #endasm
  92.  
  93. #endif  /* z80 */
  94. #endif  /* HI_TECH_C */
  95.